/* -------------------------------------------------------------------------
 *  This file is part of the Cantian project.
 * Copyright (c) 2024 Huawei Technologies Co.,Ltd.
 *
 * Cantian is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *
 *          http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 * -------------------------------------------------------------------------
 *
 * ctbackup_mysql_operator.h
 *
 *
 * IDENTIFICATION
 * src/utils/ctbackup/ctbackup_mysql_operator.h
 *
 * -------------------------------------------------------------------------
 */

#ifndef CANTIANDB_100_CTBACKUP_MYSQL_OPERATOR_H
#define CANTIANDB_100_CTBACKUP_MYSQL_OPERATOR_H

#include "ctbackup_common.h"

#ifdef __cplusplus
extern "C" {
#endif

#define MYSQL_EXE "mysql"
#define MYSQL_EXE_CMD_LONG_OPTION "--execute="
#define MYSQL_BACKUP_LOCK_SQL "'set @ctc_ddl_enabled=true; LOCK INSTANCE FOR BACKUP; do sleep(100000);'"
#define MYSQL_BACKUP_UNLOCK_SQL "UNLOCK INSTANCE"

status_t ctback_lock_mysql_for_backup(ctbak_param_t* ctbak_param);

status_t ctback_unlock_mysql_for_backup(void);

status_t ctbak_append_option_str(char* mysql_option_str, int option_str_len, const char* option_value,
                                 char* option_prefix);

#ifdef __cplusplus
}
#endif

#endif // CANTIANDB_100_CTBACKUP_MYSQL_OPERATOR_H
